Skip to main content

All Questions

2votes
2answers
1kviews

Migrating legacy code with singletons to Dependency injection

I'm working on a larger, older project. Our code is littered with classical singletons, i.e. classes like public class ABCService { private static final instance = new ABCService(); public ...
Johannes Hahn's user avatar
2votes
1answer
339views

Using Spring in Java Project

I've got a question about a correct usage of Spring. I know that some people use the DI "aggressively" so that they always use spring and completely eliminate the usage of word "new" in the ...
Mark Bramnik's user avatar
10votes
2answers
10kviews

Unit testing, factories, and the Law of Demeter

Here's how my code works. I have an object that represents the current state of something akin to a shopping cart order, stored in a 3rd party shopping API. In my controller code, I want to be able to ...
durron597's user avatar
1vote
1answer
127views

Loading data for ShoppingCart item

I'm currently trying to cover our shopping cart with unit tests. Class ShoppingCartItem has property Term. It also loads available terms for this item upon object creation. Currently this is done ...
Josef Rousek's user avatar

close